package com.kantboot.business.gc.controller;

import com.kantboot.business.gc.domain.dto.BusGcCollectSearchUserDTO;
import com.kantboot.business.gc.service.IBusGcCollectService;
import com.kantboot.util.common.result.RestResult;
import com.kantboot.util.core.param.PageParam;
import com.kantboot.util.core.result.PageResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/business/gc/collect")
public class BusGcCollectController {

    @Resource
    private IBusGcCollectService service;

    /**
     * 查询游戏是否已收藏
     */
    @RequestMapping("/queryAddCollect")
    public RestResult queryAddCollect(@RequestParam("gameId") Long gameId) {
        return RestResult.success(service.queryAddCollect(gameId),"getSuccess","获取成功");
    }

    /**
     * 获取用户收藏列表
     */
    @RequestMapping("/getBodyData")
    public RestResult<PageResult> getBodyData(@RequestBody PageParam<BusGcCollectSearchUserDTO> param) {
        return RestResult.success(service.getBodyData(param), "getSuccess", "获取成功");
    }

    /**
     * 加入收藏
     */
    @RequestMapping("/addCollect")
    public RestResult addCollect(@RequestParam("gameId") Long gameId) {
        return RestResult.success(service.AddCollect(gameId),"getSuccess","获取成功");
    }

    /**
     * 取消收藏
     */
    @RequestMapping("/cancelCollect")
    public RestResult cancelCollect(@RequestParam("gameId") Long gameId) {
        return RestResult.success(service.cancelCollect(gameId),"getSuccess","获取成功");
    }

    /**
     * 分页查询用户收藏列表
     */
    @RequestMapping("/queryAddCollectList")
    public RestResult queryAddCollectList(PageParam<BusGcCollectSearchUserDTO> pageParam) {
        return RestResult.success(service.getBy(pageParam),"getSuccess","获取成功");
    }




}
